<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var isPalindrome = function(x) {
            if (x < 0) {
                return false;
            } else if (x >= 0 && x <= 9) {
                return true;
            }
            let b = x.toString();
            let a = b.split("").reverse().join("");

            if (a === b) {
                return true;
            } else {
                return false;
            }
        };
        console.log(isPalindrome(121));
    </script>
</body>

</html>